package com.mayflygeek.mayflyask.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.mayflygeek.mayflyask.entity.Role;
/**
 * @author 蝈蝈 
 * @email guodefu909@126.com
 * @team 蜉蝣极客
 * @link www.mayflygeek.com
 * Dao接口，无需实现类，springdata会自动为其创建实现类
 */
public interface RoleDao extends JpaRepository<Role, Long>,JpaSpecificationExecutor<Role>{
	
	Role getByRoleName(String roleName);
	
	@Modifying
	@Query("UPDATE Role u SET u.status = :status WHERE id = :id")
	Role updateRoleStatus(@Param("id") Long id, @Param("status") Integer status);
}
